package com.xnyzc.lhy.order.controller.capi.order;

import com.xnyzc.lhy.common.entity.Qd;
import com.xnyzc.lhy.order.entity.order.OaCOrder;
import com.xnyzc.lhy.order.entity.system.OaSysBillRules;
import com.xnyzc.lhy.order.entity.user.OaCUser;
import com.xnyzc.lhy.order.entity.user.OaDUser;
import com.xnyzc.lhy.order.entity.user.OaDUserInfo;
import com.xnyzc.lhy.order.entity.vehicle.OaDDriverVehicle;
import com.xnyzc.lhy.order.service.order.IOaOrderCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description netty 服务间调用获取订单相关
 * @Author 刘举
 * @Date 2019/8/16 20:35
 **/
@RestController
@RequestMapping(value = "/orderCommon")
public class OaOrderCommonController {

    @Autowired
    private IOaOrderCommonService iOaOrderCommonService;

    /**
     * 获取总费用
     *
     * @param totalFee
     * @param baseFee
     * @param userType
     * @param drawRatio
     * @return
     */
    @GetMapping(value = "/getTotalFee")
    public BigDecimal getTotalFee(BigDecimal totalFee, BigDecimal baseFee, Integer userType, BigDecimal drawRatio) {
        BigDecimal totalFees = iOaOrderCommonService.getTotalFee(totalFee, baseFee, userType, drawRatio);
        return totalFees;
    }

    /**
     * 获取计费规则费用
     *
     * @param rulesId
     * @param tag
     * @return
     */
    @GetMapping(value = "/getBillRulesStartFee")
    public OaSysBillRules getBillRulesStartFee(String rulesId, String tag) {
        OaSysBillRules billRules = iOaOrderCommonService.getBillRulesStartFee(rulesId, tag);
        return billRules;
    }

    /**
     * 判断是否评价过
     *
     * @return
     */
    @GetMapping(value = "/isEvaluation")
    public Integer isEvaluation(Long userId, Integer type, String orderNo) {
        Integer isEvaluation = iOaOrderCommonService.isEvaluation(userId, type, orderNo);
        return isEvaluation;
    }

    /**
     * 获取历史轨迹
     *
     * @param orderNo
     * @return
     */
    @GetMapping(value = "/getHistroyGpsList")
    public List<Qd> getHistroyGpsList(String orderNo) {
        List<Qd> gpsList = iOaOrderCommonService.getHistroyGpsList(orderNo);
        return gpsList;
    }

    /**
     * 获取订单信息
     *
     * @param orderNo
     * @return
     */
    @GetMapping(value = "/getOrderInfo")
    public OaCOrder getOrderInfo(String orderNo) {
        OaCOrder oaCOrder = iOaOrderCommonService.getOrderInfo(orderNo);
        return oaCOrder;
    }

    /**
     * 获取用户信息
     *
     * @param userId
     * @return
     */
    @GetMapping(value = "/getUserInfo")
    public OaCUser getUserInfo(Long userId) {
        OaCUser oaCUser = iOaOrderCommonService.getUserInfo(userId);
        return oaCUser;
    }


    /**
     * 获取司机用户信息
     *
     * @param driverId
     * @return
     */
    @GetMapping(value = "/getOaDUser")
    public OaDUser getOaDUser(Long driverId) {
        OaDUser oaDUser = iOaOrderCommonService.getOaDUser(driverId);
        return oaDUser;
    }

    /**
     * 获取司机用户信息详情
     *
     * @param driverId
     * @return
     */
    @GetMapping(value = "/getOaDUserInfo")
    public OaDUserInfo getOaDUserInfo(Long driverId) {
        OaDUserInfo oaDUserInfo = iOaOrderCommonService.getOaDUserInfo(driverId);
        return oaDUserInfo;
    }

    /**
     * 获取司机车辆信息
     *
     * @param driverId
     * @return
     */
    @GetMapping(value = "/getOaDDriverVehicleInfo")
    public OaDDriverVehicle getOaDDriverVehicleInfo(Long driverId,Integer isUse) {
        OaDDriverVehicle oaDDriverVehicle = iOaOrderCommonService.getOaDDriverVehicleInfo(driverId,isUse);
        return oaDDriverVehicle;
    }
}
